// components/wxpay-apply-type/index.js
import componentBehavior from '../../../behaviors/component';
import { COMPONENT_OPTIONS } from '../../../constants/common';
import { WXPAYMENT_ORGANIZATION_TYPE, WXPAYMENT_ORGANIZATION_TYPE_VALUE } from '../../../constants/payment';

Component({
    behaviors: [componentBehavior],
    options: {
        ...COMPONENT_OPTIONS,
    },
    properties: {
        type: {
            type: String,
            value: '',
        },
        disabled: {
            type: Boolean,
            value: false,
        },
    },
    data: {
        WXPAYMENT_ORGANIZATION_TYPE,
        WXPAYMENT_ORGANIZATION_TYPE_VALUE,
    },
    methods: {
        handleSelect() {
            const { type, disabled } = this.data;
            if (!disabled) {
                this.triggerEvent('select', type);
            }
        },
    }
})
